import { getAppData, setGlobalData } from '@utils/tools'
import { AtTabs, AtTabsPane, AtList } from "taro-ui"
import { BaseComponent } from '@common/components/base-component';
import { BasePage } from '@common/components/base-page'
import NavigationBar from '@components/navBar'
import PanelMeida from '@components/panel-media'
import Jump from '@utils/jump'
import AppRoute from '@utils/route/index'
import deleteIcon from '../../../assets/img/delete.png'
import { View, Image, Text, Input, Textarea, Radio, Button } from '@tarojs/components'
import './index.scss'

interface CProps {
    selectMedia: boolean,
    close: Function,
}
interface CState {
    clickedSelectPanel: boolean,
    selectedPlat: string
}

export default class addMedia extends BaseComponent<CProps, CState> {
    constructor(props) {
        super(props);
        this.state = {
            clickedSelectPanel: false,
            selectedPlat: ''
        }
    }
    componentDidShow() {
    }

    render() {
        const handlePlatform = () => {
            this.setState({
                clickedSelectPanel: true
            })
            // console.log('点击了输入框请选择平台')
        }
        const closeMediaChange = (plat) => {
            console.log(plat, '选择的平台')

            this.setState({
                selectedPlat: plat.title,
                clickedSelectPanel: false
            })
        }
        const { selectedPlat } = this.state
        return (
            <>
                <NavigationBar backPageShow={true} titleColor="black" barBackgroundColor='white' title="添加社媒账号"></NavigationBar>
                <View className='media-list a-base'>
                    <View className='form-item'>
                        <Text className='person'>平台</Text>
                        <Input onClick={handlePlatform} value={selectedPlat} type='text' placeholder='选择平台' placeholderClass='place' focus />
                    </View>
                    <View className='form-item'>
                        <Text className='person'>昵称</Text>
                        <Input type='text' placeholder='收件人姓名' placeholderClass='place' focus />
                    </View>
                    <View className='form-item'>
                        <Text className='person'>粉丝数</Text>
                        <Input type='text' placeholder='输入粉丝数' placeholderClass='place' focus />
                    </View>
                    <View className='form-item'>
                        <Text className='person'>主页链接</Text>
                        <Input type='text' placeholder='请输入主页链接' placeholderClass='place' focus />
                    </View>
                    {/* 编辑社媒账号 */}
                    {/* <View className='del'>
                        <Image className='delete-icon' src={deleteIcon}></Image>
                        <Text>删除</Text>
                    </View> */}
                </View>
                <View className='btn-save'>
                    <Button onClick={() => { }} className='a-btn'>保存</Button>
                </View>
                <PanelMeida selectMedia={this.state.clickedSelectPanel} close={closeMediaChange} />
            </>
        )
    }
}
